import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2022-12-30
 * Time: 下午 22:22
 */
@WebServlet("/redirect")
public class RedirectServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //1.永久从定向 状态码+指令
        //resp.setStatus(302);
        //resp.setHeader("Location","Https://www.sogou.com");

        //2.永久从定向,简单写法
        resp.sendRedirect("Https://www.sogou.com");
    }
}
